<?php

namespace App\Services\User;

use App\Models\Site;
use App\Models\User;

/**
 * 用户服务
 * @package App\Services\User
 */
class UserService
{
    /**
     * 登录字段
     *
     * @return string
     */
    public function account(): string
    {
        return filter_var(request()->account, FILTER_VALIDATE_EMAIL) ? 'email' : 'mobile';
    }

    /**
     * 超级管理员检测
     *
     * @param User $user
     * @return boolean
     */
    public function isSuperAdmin(User $user): bool
    {
        return $user->id===1;
    }
}
